package w3

//name,age,sex默认称为类的属性
class Dog(var name: String, var age: Int, val sex: String) {
  def this(age: Int) = {
    this("无名", age, "公")
  }
}

object TestDog {
  def main(args: Array[String]): Unit = {
    var d1 = new Dog(11)
    println(d1.name + "," + d1.age + "," + d1.sex)
    var d2 = new Dog("小花", 4, "母狗")
    println(d2.name + "," + d2.age + "," + d2.sex)
  }
}
